<!DOCTYPE html>
<html>
<head>
<meta charset="US-ASCII">
<title>G3DM Specification</title>
</head>
<body>
  <h1>G3DM Specification</h1>
  <p>This is the specification of the Graphiclicious 3D Model format.</p>

  <h2>Structure</h2>
  <p>The structure of the G3DM format looks as following.</p>
  <ol>
    <li>Number of materials [int, 4]</li>
    <li>For every material: <a href="#Materials">Material</a>
    <li>Number of meshes [int, 4]</li>
    <li>For every mesh: <a href="#Meshes">Mesh</a></li>
    <li>Root node: The root node which contains all the other nodes. See <a
      href="#Nodes">Nodes</a>.
    </li>
  </ol>

  <h2 id="Materials">Materials</h2>
  <p>Every material has this structure:</p>
  <ol>
    <li>Alpha</li>
    <li>Ambient Color [3x float]</li>
    <li>Diffuse Color [3x float]</li>
  </ol>

  <h2 id="Meshes">Meshes</h2>
  <p>Every mesh has this structure:</p>
  <ol>
    <li>Index size [int, 4]</li>
    <li>Number of vertices [int, Index size]</li>
    <li>For every vertex:
      <ol>
        <li>X [float]</li>
        <li>Y [float]</li>
        <li>Z [float]</li>
      </ol>
    </li>
    <li>Number of material groups [int, 4]</li>
    <li>For every material group:
      <ol>
        <li>Material index [int, 4]</li>
        <li>Number of triangles [int, 4]</li>
        <li>For every triangle:
          <ol>
            <li>Index A [int, Index size]</li>
            <li>Index B [int, Index size]</li>
            <li>Index C [int, Index size]</li>
          </ol>
        </li>
      </ol>
    </li>
  </ol>


  <h2 id="Nodes">Nodes</h2>
  <p>Every Node contains its children. So this is a recursive structure.</p>
  <ol>
    <li>Number of meshes [int, 4]</li>
    <li>For every mesh:
      <ol>
        <li>Mesh id [int, 4]: Refers to a mesh in the above mesh list.</li>
      </ol>
    </li>
    <li>Number of children [int, 4]</li>
    <li>For every child: Recursive
  </ol>
</body>
</html>
